package com.hsjk.szwj.module.official.dal.mysql.unit;

import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.framework.mybatis.core.mapper.BaseMapperX;
import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.module.official.controller.admin.unit.vo.AdminModuleFeedPageReqVO;
import com.hsjk.szwj.module.official.controller.app.unit.vo.AppModuleFeedPageReqVO;
import com.hsjk.szwj.module.official.dal.dataobject.unit.OfficialWebsiteModuleFeedDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/11/24 00:08
 **/
@Mapper
public interface IOfficialWebsiteModuleFeedMapper extends BaseMapperX<OfficialWebsiteModuleFeedDO> {
    default PageResult<OfficialWebsiteModuleFeedDO> selectAdminPage(AdminModuleFeedPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteModuleFeedDO>()
                .eqIfPresent(OfficialWebsiteModuleFeedDO::getFeedType, reqVO.getFeedType())
                .eqIfPresent(OfficialWebsiteModuleFeedDO::getFeedShowType, reqVO.getFeedShowType())
                .orderByDesc(OfficialWebsiteModuleFeedDO::getCreateTime));
    }

    default PageResult<OfficialWebsiteModuleFeedDO> selectAppPage(AppModuleFeedPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteModuleFeedDO>()
                .eqIfPresent(OfficialWebsiteModuleFeedDO::getFeedType, reqVO.getFeedType())
                .eqIfPresent(OfficialWebsiteModuleFeedDO::getFeedShowType, reqVO.getFeedShowType())
                .orderByDesc(OfficialWebsiteModuleFeedDO::getCreateTime));
    }
}
